package list.trst.Demo3;

public class FlyableDemo {
    public static void main(String[] args) {
        Flyable f =new Flyable(){
            @Override
            public void fly(String work) {
                System.out.println("我想吃"+work+"的鸟");
            }
        };
        f.fly("会飞");



        useFlyable(new Flyable() {
            @Override
            public void fly(String work) {
                System.out.println(work);
            }
        });
        System.out.println("--------------");

        useFlyable( work-> System.out.println(work));

        System.out.println("-------------");

        new Flyable(){
            @Override
            public void fly(String work) {
                System.out.println(work);
            }
        }.fly("我要飞,我要飞");
    }
    public static void useFlyable(Flyable f){
        f.fly("我要飞，我要飞");
    }
}
